package com.dm.learn.java.pattern.productor_consumer1;

/**
 * 
 * @ClassName: Consumer
 * @author Damon.Han
 * @Description: 消费者
 * @date 2014-3-21 下午2:24:29
 * 
 */
public class Consumer implements Runnable {
	ThreadManager tm;

	public Consumer(ThreadManager tm) {
		this.tm = tm;
	}

	@Override
	public void run() {
		for (int i = 0; i < 50; i++) {
			try {
				// 这里sleep500ms表示正在消费
				Thread.sleep(500);
				tm.consumer();
			} catch (Exception e) {
				e.printStackTrace();
			}
		}
	}

}
